package com.dingwei.superiordiary.ui.activity;

import android.os.Bundle;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.ImageView;
import android.widget.TextView;

import com.dingwei.superiordiary.R;
import com.lihao.baselibrary.base.BaseActivity;

import butterknife.Bind;
import butterknife.ButterKnife;
import butterknife.OnClick;

/**
 * Created by lihao on 2018/1/11.
 * 自动压缩图片上传设置
 */

public class PictureQualitySettingActivity extends BaseActivity implements CompoundButton.OnCheckedChangeListener {

    @Bind(R.id.img_back)
    ImageView imgBack;
    @Bind(R.id.tv_title)
    TextView tvTitle;
    @Bind(R.id.tv_right)
    TextView tvRight;
    @Bind(R.id.checkbox)
    CheckBox checkbox;


    @Override
    protected int getContentViewId() {
        return R.layout.activity_picture_quality_setting;
    }

    @Override
    protected void initData() {

    }

    protected void initView() {
        tvTitle.setText("图片质量设置");

        if (BaseActivity.value.getPicQuality()) {
            checkbox.setChecked(true);
        } else {
            checkbox.setChecked(false);
        }
        checkbox.setOnCheckedChangeListener(this);
    }

    @Override
    protected void initListener() {

    }

    @Override
    public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
        BaseActivity.value.setPicQuality(isChecked);
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        // TODO: add setContentView(...) invocation
        ButterKnife.bind(this);
    }

    @OnClick(R.id.img_back)
    public void onViewClicked() {
        finish();
    }
}
